package org.akomantoso.core.io.util.group;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

import org.akomantoso.core.data.ActiveRef;
import org.akomantoso.core.data.AttachmentOf;
import org.akomantoso.core.data.HasAttachment;
import org.akomantoso.core.data.Jurisprudence;
import org.akomantoso.core.data.Original;
import org.akomantoso.core.data.PassiveRef;
import org.akomantoso.core.data.group.DocRef;
import org.akomantoso.core.io.util.Instantiator;

/**
 * @author <a href="mailto:jacques.militello@gmail.com">Jacques Militello</a>
 */
public class DocRefGroup {

	private DocRefGroup() {
	}

	public static final Map<String, Instantiator<DocRef>> MAP;

	static {

		Map<String, Instantiator<DocRef>> temp = new HashMap<String, Instantiator<DocRef>>();

		// original
		temp.put(Original.ELEMENT, new Instantiator<DocRef>() {
			public Original instantiate() {
				return new Original();
			}
		});

		// attachmentOf
		temp.put(AttachmentOf.ELEMENT, new Instantiator<DocRef>() {
			public AttachmentOf instantiate() {
				return new AttachmentOf();
			}
		});

		// jurisprudence
		temp.put(Jurisprudence.ELEMENT, new Instantiator<DocRef>() {
			public Jurisprudence instantiate() {
				return new Jurisprudence();
			}
		});

		// activeRef
		temp.put(ActiveRef.ELEMENT, new Instantiator<DocRef>() {
			public ActiveRef instantiate() {
				return new ActiveRef();
			}
		});

		// passiveRef
		temp.put(PassiveRef.ELEMENT, new Instantiator<DocRef>() {
			public PassiveRef instantiate() {
				return new PassiveRef();
			}
		});

		// hasAttachment
		temp.put(HasAttachment.ELEMENT, new Instantiator<DocRef>() {
			public HasAttachment instantiate() {
				return new HasAttachment();
			}
		});

		MAP = Collections.unmodifiableMap(temp);
	}
}
